
Page({
  /**
   * 页面的初始数据
   */
  data: {
    //banner 数据源
    bannerImages : [
      'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
      'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg',
      'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'
      ],
    voice_img: "../../imgs/rnol_home/rnol_home_ voice@2x.png", 
    msgList : [
      "小岗村xxx幸运玩家中了一台iPhone X",
      "范海文同学喜提磁悬浮列车一台",
      "融牛在线即将上线银行存管,迎接p2p理财新时代"
    ],
    //四个按钮的数据
    homeIconTitles : ["产品介绍","平台数据","安全保障","新手指引"],
    homeIconImgs : [
      "../../imgs/rnol_home/rnol_home_icon001@2x.png", 
    "../../imgs/rnol_home/rnol_home_icon002@2x.png", 
    "../../imgs/rnol_home/rnol_home_icon003@2x.png",
    "../../imgs/rnol_home/rnol_home_icon004@2x.png"
    ]
  },
  

  //提示事件信息
  showAlertMsg: function (msg) {
    wx.showToast({
      title: msg,
      icon: 'success',
      duration: 2000
    })
  },

  //banner点击
  bannerClickAction : function(event){
    var index = event.currentTarget.dataset.index;
     this.showAlertMsg(index.toString());
  },

  //公告点击
  clickNoticeAction : function(event){
    var index = event.currentTarget.dataset.index;
    var msg = this.data.msgList[index];
    this.showAlertMsg(msg);
  },
  
  moreAction : function(){
    this.showAlertMsg("更多");
  },

  //按钮点击事件
  clickButtonAction:function (event){
    var index = event.currentTarget.dataset.index;
    var buttonTitle = this.data.homeIconTitles[index];
    this.showAlertMsg(buttonTitle);
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    wx.setNavigationBarTitle({
      title: '首页',
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    // wx.showLoading({
    //   title: '下拉刷新'
    //  })
    //  setTimeout(function(){
    //   wx.hideLoading()
    //   wx.stopPullDownRefresh()
    //  },2000)
    
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    // wx.showLoading({
    //   title: '上拉加载',
    // })
    // setTimeout(function(){
    //   wx.hideLoading()
      
    // },2000)

    // console.log("上拉加载...");

  },


  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    
  }
})